package com.example.demo.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaohei.crm.common.result.Result;
import com.xiaohei.crm.dao.User;
import com.xiaohei.crm.dao.dto.UserLoginReqDTO;
import com.xiaohei.crm.dao.dto.UserLoginRespDTO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;


public interface UserService extends IService<User>{

    /**
     * 根据名字查询数据库
     * @param username
     * @return
     */
    User getByUsername(String username);

    Result<IPage> findByPage(Integer pageIndex, Integer pageSize, String username,String name);

    /**
     * 添加用户
     * @param user
     * @return
     */
    void saveUser(User user);

    /**
     * 根据用户名称修改用户信息
     * @param user
     */
    void updateByUsername(User user);

    void removeByUsername(String username);

    UserLoginRespDTO login(UserLoginReqDTO requestParams);

    Boolean checkLogin(String username, String token);

    void logOut(String username, String token);

    UserLoginRespDTO loginWithJwt(HttpServletRequest request, HttpServletResponse response, UserLoginReqDTO requestParams);

}
